{#
This file is part of EC-CUBE

Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.

http://www.ec-cube.co.jp/

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#}
{% extends 'default_frame.twig' %}

{% block main %}
    <h1 class="page-heading">お届け先の指定</h1>
    <div id="deliver_wrap" class="container-fluid">
        <form method="post" action="{{ url('shopping_shipping', {'id': shippingId}) }}">
            <div id="deliveradd_select" class="row">
                <div id="list_box__body" class="col-sm-10 col-sm-offset-1">
                    <p id="list_box__add_button">
                    {% if Customer.CustomerAddresses|length < app.config.deliv_addr_max %}
                        <a href="{{ url('shopping_shipping_edit', {'id': shippingId}) }}" class="btn btn-default btn-sm">新規お届け先を追加する</a>
                    {% else %}
                        <span id="list_box__deliv_addr_max_message" class="text-danger">お届け先登録上限の{{ app.config.deliv_addr_max }}件に達しています。お届け先を入力したい場合は、削除か変更を行ってください</span>
                    {% endif %}
                    </p>
                    {% if error %}
                        <p id="list_box__deliv_addr_alert" class="text-danger">お届け先を指定してください。</p>
                    {% endif %}

                    {% if Customer.CustomerAddresses|length > 0 %}
                     <div id="list_box__list_body" class="table address_table">
                        <div id="list_box__list_body_inner" class="tbody">
                            {% for CustomerAddress in Customer.CustomerAddresses %}
                            <div id="list_box__item--{{ CustomerAddress.id }}" class="addr_box tr">
                            <div id="list_box__id--{{ CustomerAddress.id }}" class="icon_radio td"><input type="radio" id="address{{ CustomerAddress.id }}" class="no-style" name="address" value="{{ CustomerAddress.id }}" /></div>
                            <div id="list_box__address_area--{{ CustomerAddress.id }}" class="column td">
                                <label for="address{{ CustomerAddress.id }}">
                                    <p id="list_box__address--{{ CustomerAddress.id }}" class="address">
                                        {{ CustomerAddress.name01 }}&nbsp;{{ CustomerAddress.name02 }}<br>
                                        〒{{ CustomerAddress.zip01 }}-{{ CustomerAddress.zip02 }} {{ CustomerAddress.Pref }}{{ CustomerAddress.addr01 }}{{ CustomerAddress.addr02 }}<br>
                                        {{ CustomerAddress.tel01 }}-{{ CustomerAddress.tel02 }}-{{ CustomerAddress.tel03 }}
                                    </p>
                                </label>
                            </div>
                            </div>
                            {% endfor %}
                            </div>
                        </div><!--/table-->
                        {% endif %}

                    <div id="list_box__button_menu" class="row no-padding">
                        <div class="btn_group col-sm-offset-4 col-sm-4">
                            <p id="list_box__confirm_button"><button type="submit" class="btn btn-primary btn-block">選択したお届け先に送る</button></p>
                            <p id="list_box__back_button"><a href="{{ url('shopping') }}" class="btn btn-info btn-block">戻る</a></p>
                        </div>
                    </div>

                </div>
            </div><!-- /.row -->
        </form>

    </div>
{% endblock %}
